var MessageCreatePact = function(){
	
	//test
	 var individual = [{
      
         
        bodyStyle: 'padding-left:5px;',
     
            // Use the default, automatic layout to distribute the controls evenly
            // across a single row
            xtype: 'checkboxgroup',
            fieldLabel: '接收人',
      		columns: 4,
            vertical: true,
            items: [
                {boxLabel: '张三', name: 'rb-auto', inputValue: 1},
                {boxLabel: '李四', name: 'rb-auto', inputValue: 2},
                {boxLabel: '王五', name: 'rb-auto', inputValue: 3},
                {boxLabel: '赵六', name: 'rb-auto', inputValue: 4},
                {boxLabel: '庚七', name: 'rb-auto', inputValue: 5},
                {boxLabel: '杜八', name: 'rb-auto', inputValue: 5}
            ]
            
        
        } 
    ];
	var searchComplateDate = new Ext.form.DateField( {
		fieldLabel : '合同有效期',
		format : 'Y-m-d',
		width : 150
	});
	
	var fileUpload = new Ext.form.FileUploadField({
		fieldLabel : '上传附件',
		emptyText: '请选择要上传的文件',
		width : 520,
		name : 'fileName',
		buttonText: '',
		buttonCfg: {
            iconCls: 'icon-compress'
        }
       
	});
	
	
	var MessageType = new Ext.form.ComboBox( {
		fieldLabel : '消息类型',
		//hiddenName : 'type',
		
		mode : 'local',
		displayField : 'NAME',
		triggerAction : 'all',
		editable : false,
		valueField : 'AREA_ID',
		typeAhead : true,
		width : 150,
		emptyText : '---请选择---',
		selectOnFocus : true
	});
	
	
	
	var ps = new ProjectSourceDemo();
	
	var createInfoStore = new Ext.data.JsonStore(
			{
				url : '../project/searchProjects.form?status=10&timesnap=' + new Date().getTime(),
				root : 'result',
				fields : [ 'PROJECT_ID', 'PROJECT_NAME', 'AREA_ID',
						'PROJECT_TYPE', 'EST_AMT', 'PROJECT_CREATE_DT',
						'EST_DT', 'JOIN_LEADER', 'CUSTOMER_NAME', 'STAFF_NUM',
						'CONTACT_PERSON', 'OFF_TEL', 'MOBILE', 'EMAIL',
						'PROJECT_TARGET', 'CUST_REQ', 'SERVICE_REQ',
						'IMP_FUNC', 'OWNER_PROVIDE', 'REMARK', 'COMPETITOR',
						'PROJECT_OWNER', 'INVOLVE_DT', 'ADVANTAGE',
						'DISADVANTAGE', 'CREATE_USER', 'CREATE_DT', 'MOD_USER',
						'MOD_DT' ]
			});
	var createGrid = new Ext.grid.GridPanel({
		width : 930,
		height : 300,
		store : createInfoStore,
		scope : this,
		listeners : {
			scope : this,
			rowmousedown : function(grid,index,e){
				var data = grid.store.getAt(index).data;
				ps.setCompValueAndDisabled(data);
				ps.projectIsVs.setValue(true);
				//ps.projectInfo.disable();ps.projectNeed.disable();
		       // ps.projectIsVs.setValue(true);ps.projectVsInfo.disable();
		        
			}
		},
		columns : [{header:'客户名称',sortable: true,width: 150,dataIndex:'PROJECT_ID'},
		           {header:'所属区域',sortable: true,width: 100, dataIndex:'PROJECT_NAME'},
		           {header:'项目类型',sortable: true,dataIndex:'AREA_ID',renderer:function(value,row){return ps.getGridAreaMap()[value];}},
		           {header:'公司地址',sortable: true,renderer:ps.renderprojectType,dataIndex:'PROJECT_TYPE'},
		           {header:'联系人姓名',sortable: true,dataIndex:'OWNER_PROVIDE'},
		           {header:'城市',sortable: true,dataIndex:'PROJECT_CREATE_DT'},
		           {header:'城市等级',sortable: true,dataIndex:'EST_DT'},
		           {header:'联系人电话',sortable: true,renderer: 'usMoney',dataIndex:'EST_AMT'}],
       bbar:new Ext.PagingToolbar({
		 pageSize: 5,
         store: createInfoStore,
         displayInfo: true,
         displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
         emptyMsg: "没有记录..."
       })
	});
	
	var agree = new Ext.form.Radio( {
		boxLabel : '是',
		name : 'status',
		checked:true,
		inputValue : 11
	});

	var unAgree = new Ext.form.Radio( {
		boxLabel : '否',
		name : 'status',
		inputValue : 12
	});
	
	var isAgree = new Ext.form.RadioGroup({
		fieldLabel : '是否签约',
		columns : 2,
		items : [agree,unAgree]
	});
	
	var remark = new Ext.form.TextArea({
		fieldLabel : '合同细节',
		width : 840,
		height:200
	});
	
	this.MessagecreatePanel = new Ext.form.FormPanel({
		  labelAlign: 'top',
        frame:true,
      //  title: '日报',
        bodyStyle:'padding:5px 5px 0',
        width: 950,
        items: [{
            layout:'column',
            items:[{
                columnWidth:.4,
                layout: 'form',
                items: [{
                    xtype:'textfield',
                    fieldLabel: '主题',
                    name: 'first',
                    anchor:'95%'
                }]
            },{
                columnWidth:.19,
                layout: 'form',
                items: [{
                    fieldLabel: '发布日期',
                    defaultType: 'datefield',
                    
                items: [{
                    fieldLabel: 'Date',
                    name: 'date',
                    format : 'Y-m-d',
                    width : 150
                 }
                 ]                
                }]
            } ,{
            columnWidth:.2,
                layout: 'form',
             items: [MessageType]
            }
              ,{
            columnWidth:1,
                layout: 'form',
             items: [individual]
            }
            
            
            ]
            
            
        },{
            xtype:'htmleditor',
            id:'bio',
            fieldLabel:'消息内容',
            height:300,
            anchor:'98%'
        },
       fileUpload
        ],

        buttons: [{
            text: '发布'
        },{
            text: '取消'
        }]
        //fileUpload
	});
	//确定立项信息路径
	var addCon = new Ext.data.Connection({
		url:'../project/doCreateProject.form?timesnap=' + new Date().getTime(),
		method:'post'
	});
	var doCreate = function(dp){
		var projectId = ps.getProjectId();
		if(projectId!=''){
		    var r = isAgree.getValue();  
		    var value = r.inputValue;  
			Utils.request(addCon,{
				params:{
					project_id:projectId,
					project_status:value,
					remark:remark.getValue()
				},
				success:function(data){
					if(data.result=='true'){
						Utils.info("操作成功","系统提示");	
						createInfoStore.reload();
						dp.getForm().reset();
					}else{
						Utils.info("操作失败","系统提示");	
					}
				}
			});
		}else{
			Utils.info("请选择确定要立项的项目","系统提示");	
		}
	};
};